package modelo.bean;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.annotate.JsonManagedReference;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
@XmlRootElement
@Entity
@PrimaryKeyJoinColumn(name="idProfessor")
public class Professor extends Usuario implements Serializable {
	/**
	 * 
	 */
	private Integer cargaHoraria;
	private String titulo;
	
	public Professor(){
		
	}
	@OneToMany(mappedBy="professor", cascade=CascadeType.ALL)
	@JoinColumn(name="professor_id")
	@org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
	private List<Prova> listaDeProvas;
	
	@OneToMany(mappedBy ="professor", cascade=CascadeType.ALL)
	@Fetch(FetchMode.JOIN)
	@org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
	private List<Disciplina> listaDeDisciplinas;
	
	private static final long serialVersionUID = 1L;
	public Integer getCargaHoraria() {
		return cargaHoraria;
	}

	public void setCargaHoraria(Integer cargaHoraria) {
		this.cargaHoraria = cargaHoraria;
	}

	public String getTitulo() {
		return titulo;
	}

	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}

	@JsonManagedReference("professor-prova")
	public List<Prova> getListaDeProvas() {
		return listaDeProvas;
	}

	public void setListaDeProvas(List<Prova> listaDeProvas) {
		this.listaDeProvas = listaDeProvas;
	}

	@JsonManagedReference("professor-disciplina")
	public List<Disciplina> getListaDeDisciplinas() {
		return listaDeDisciplinas;
	}

	public void setListaDeDisciplinas(List<Disciplina> listaDeDisciplinas) {
		this.listaDeDisciplinas = listaDeDisciplinas;
	}
	
}
